//package com.zmn.plat.dubbo.impl.channel;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import javax.annotation.Resource;
//
//import org.apache.commons.lang.StringUtils;
//import org.apache.dubbo.config.annotation.Service;
//import org.springframework.cache.annotation.Cacheable;
//import org.springframework.cglib.beans.BeanCopier;
//
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
//import com.zmn.plat.common.dto.channel.ChannelDnisDRO;
//import com.zmn.plat.dubbo.interfaces.channel.ChannelDnisListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.channel.Channel;
//import com.zmn.plat.model.entity.channel.ChannelDnis;
//import com.zmn.plat.model.entity.channel.ChannelDnisQuery;
//import com.zmn.plat.services.interfaces.channel.ChannelDnisService;
//
///**
// * 描述: ChannelDnis dubbo接口
// *
// * @author tanghongjun
// * @since: 2019/2/19 17:44
// */
//@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
//public class ChannelDnisListRemoteServiceImpl implements ChannelDnisListRemoteService {
//
//    @Resource
//    protected ChannelDnisService channelDnisService;
//
//    @Override
//    @ReadOnlyConnection
//    @Cacheable(key = "'dubbo:list:channel:dnis:'+#p0", cacheNames = "redis1h")
//    public ResponseDTO<List<ChannelDnisDRO>> listByDnis(String dnis) {
//        if (StringUtils.isEmpty(dnis)) {
//            ResponseDTO.fail("入参不能为空");
//        }
//
//        ChannelDnisQuery query = new ChannelDnisQuery();
//        query.setDnis(dnis);
//        List<ChannelDnis> baseChannelList = channelDnisService.listByQuery(query);
//        List<ChannelDnisDRO> baseChannelDROList = new ArrayList<>();
//        BeanCopier copier = BeanCopier.create(ChannelDnis.class, ChannelDnisDRO.class, false);
//        baseChannelList.forEach(baseChannel -> {
//            ChannelDnisDRO channelDnisDRO = new ChannelDnisDRO();
//            copier.copy(baseChannel, channelDnisDRO, null);
//            baseChannelDROList.add(channelDnisDRO);
//        });
//
//        return ResponseDTO.success(baseChannelDROList, "OK");
//    }
//
//    private List<ChannelDnisDRO> toDROList(List<Channel> channelList) {
//        List<ChannelDnisDRO> baseChannelDROList = new ArrayList<>();
//        BeanCopier copier = BeanCopier.create(Channel.class, ChannelDnisDRO.class, false);
//        channelList.forEach(channel -> {
//            ChannelDnisDRO baseChannelDRO = new ChannelDnisDRO();
//            copier.copy(channel, baseChannelDRO, null);
//            baseChannelDROList.add(baseChannelDRO);
//        });
//
//        return baseChannelDROList;
//
//    }
//}
